package com.mvvm.ktnet.ui.recyclerView

import android.view.View
import com.android.ktx.view.setViewWidth
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.mvvm.ktnet.R

class TestAdapter :
    BaseQuickAdapter<SportMonthBean, BaseViewHolder>(R.layout.item_layout_sport_month) {

    private var itemWidth = 150

    override fun convert(holder: BaseViewHolder, item: SportMonthBean) {

        holder.getView<View>(R.id.root).setViewWidth(itemWidth)

        holder
            .setText(R.id.year,item.year.toString())
            .setText(R.id.month,item.month.toString())

    }

    fun setItemWidth(itemWidth: Int) {
        this.itemWidth = itemWidth
        notifyDataSetChanged()
    }


}